#include"string.h"
#define _CRT_SECURE_NO_WARNINGS 1
void test1()
{
	imitate::string s("hello");
	imitate::string a;
	a = s;
	cout << a << s << endl;
	cin >> s >> a;
	cout << s << a << endl;
}
void test2()
{
	imitate::string s("hello");
	imitate::string::iterator it=s.begin();
	while (it != s.end())
	{
		cout << (*it);
		it++;
	}
	for (auto e : s)
	{
		cout << e;//<< endl;
	}
	cout << endl;
	size_t i = 0;
	for (i = 0; i < s.size(); i++)
	{
		s[i] = 'x';
		cout << s[i];
	}
	
	
}
void test3()
{
	imitate::string s("x");
	imitate::string b("x");
	s != b;
	s < b;
	s >= b;
	s > b;
	s <= b;
	s == b;
	cout << (s >= b) << endl;
	cout << (s <= b) << endl;
	cout << (s < b) << endl;
	cout << (s > b) << endl;
	cout << (s == b) << endl;
	cout << (s != b) << endl;
}
void test4()
{
	imitate::string s("hello");
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.push_back('d');
	s.append("world");
	s += 'a';
	s += "bit";
	cout << s << endl;
	const imitate::string d("hello");
}
void test5()
{
	imitate::string d("hello");
	d.erase(1, 1);
	cout << d << endl;
}
void test6()
{
	imitate::string s("helloworld\0 xxxxxxxxxxxxxxxxxx");
	//size_t i = s.find("lo");
	//cout << i << endl;
	/*s.insert('a',1);
	s.insert('x',3);
	cout << s << endl;*/
	//s.insert("worldaaaaaaa\0xxxxxxxxxx", 5);
	cout << s.c_str() << endl;
	size_t i = 0;
	for (i = 0; i < s.size(); i++)
		cout << s[i];
}
int main()
{
	try
	{
		//test1();
		//test2();
		//test3();
		//test4();
		//test5();
		test6();
	}
	catch (const std::exception& e)
	{
		std::cout << e.what() << std::endl;
	}
	return 0;
}
